#ifndef CONTROL_HPP
#define CONTROL_HPP

#include <string>
#include <boost/thread/mutex.hpp>
#include <corechain.hpp>
#include <transport.hpp>

class Controler
{
public:
   enum State {FILES,LISTEN,STOP,RUN,PAUSE,ERROR};
   static Controler* Instance();
   State getState();
   void loadFiles(std::string chain, std::string route, std::string ipc = "");
   void resetState();
   void startListner();
   void pause();
   void start();


   //Monitoring
   uint getAvgLatency();
   uint getAvgThroughput();

private:
   Controler();

   boost::mutex mutex_;
   State state_;
   std::string chainFile_;
   std::string routeFile_;
   pland::Chain* chain_;
   kport::Transport* transport_;
};

#endif // CONTROL_HPP
